package com.xiong.util;

import java.util.Random;

public class RandomNumberGenerator {

    public  static  void  main(String[]  args)  {
        float   min   =   1000.0f;   //   最小值
        float   max   =   1001.0f;   //   最大值
        float   randomNumber   =   generateRandomNumber(min,  max);
        System.out.println("生成的随机数是:"  +  randomNumber);
    }

    public  static  float  generateRandomNumber(float   min,   float   max)  {
        Random random = new   Random();
        float   randomNumber = random.nextFloat()  *  (max  -  min)  +  min;
        return   randomNumber;
    }
}
